@extends('admin.layout')
@section('title',$title)
@section('content')
    <div class="content-wrapper">
        <section class="content-header">
            <h1>
                商品管理
                <small>在这里，你可以修改商品</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url('/admin/user/index')}}"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="{{ url('/admin/good/add')}}">商品管理</a></li>
                <li class="active">修改</li>
            </ol>
        </section>  

        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速修改商品</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{ url('admin/good/update') }}" method="post" enctype="multipart/form-data">
                        {{ csrf_field() }}
                            <div class="box-body">
                            @if (count($errors) > 0)
                                <div class="alert alert-danger">
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            @endif
                            <input type="hidden" name="gid" value="{{ $data -> gid}}">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">商品名称</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="gname" value="{{ empty(old('gname'))?$data -> gname:old('gname')}}" 
                                           placeholder="请输入商品名称">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">定价</label>
                                    <input type="text" class="form-control" id="exampleInputPassword1" name="price" value="{{ empty(old('price'))?$data -> price:old('price')}}"
                                           placeholder="请输入商品定价">
                                </div>
                                 
                                <div class="form-group">
                                    <label for="exampleInputEmail1">库存</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="cnt" value="{{ empty(old('cnt'))?$data -> cnt:old('cnt')}}"
                                           placeholder="请输入库存量">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputFile">商品图片</label>
                                    
                                    <input name="gpic" type="file" id="exampleInputFile">
                                    <img src="{{asset('$data -> gpic')}}" width="100px;">
                                </div>
                                <!-- textarea -->
                                <div class="form-group">
                                    <label>商品描述</label>
                                    <textarea class="form-control" name="gdesc" rows="3" placeholder="请输入关于的商品描述">{{ empty(old('gdesc'))?$data -> gdesc:old('gdesc')}}</textarea>
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">修改</button>
                            </div>
                        </form>
                    </div><!-- /.box -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection